package com.imooc.demo.converter;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.imooc.demo.dataobject.OrderDetail;
import com.imooc.demo.dto.OrderDTO;
import com.imooc.demo.enums.ResultEnum;
import com.imooc.demo.exception.SellException;
import com.imooc.demo.form.OrderForm;

import java.util.ArrayList;
import java.util.List;

/**
 * @Auther: 杨通通
 * @Date: 2021/11/7 20:25
 * @Description:
 */
public class OrderForm2OrderDTOConverter {

    public static OrderDTO convert(OrderForm orderForm){
        Gson gson = new Gson();
        OrderDTO orderDTO = new OrderDTO();
        orderDTO.setBuyerOpenid(orderForm.getOpenid());
        orderDTO.setBuyerPhone(orderForm.getPhone());
        orderDTO.setBuyerAddress(orderForm.getAddress());
        orderDTO.setBuyerName(orderForm.getName());



        orderDTO.setOrderDetailList(orderForm.getItems());

        return orderDTO;
    }
}